package com.yufubao.api.controller.common;

import com.yufubao.framework.annotation.AutAccess;
import com.yufubao.framework.annotation.SystemLog;
import com.yufubao.framework.constant.NotesConstant;
import com.yufubao.framework.result.ResponseResult;
import com.yufubao.service.service.common.OssService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 张一恒
 * @version 1.0
 * @description:
 * @date 2024/9/4 21:51
 */
@RestController
@RequestMapping("/applet/common/oss")
public class OssController {

    @Autowired
    private OssService ossService;

    /**
     * 获取上传营业执照签名信息
     */
    @AutAccess
    @ApiOperation(value = "获取上传营业执照签名信息", notes = NotesConstant.TEST)
    @RequestMapping(value = "/getLicencePolicy", method = RequestMethod.GET)
    @SystemLog(info = "获取上传营业执照签名信息")
    public ResponseResult getLicencePolicy(@RequestParam("objectName") String objectName) {
        return ossService.getLicencePolicy(objectName);
    }


    /**
     * 获取上传一般图片签名信息
     */
    @ApiOperation(value = "获取上传一般图片签名信息", notes = NotesConstant.TEST)
    @RequestMapping(value = "/getOrdinaryPolicy", method = RequestMethod.GET)
    @SystemLog(info = "获取上传一般图片签名信息")
    public ResponseResult getOrdinaryPolicy(@RequestParam("objectName") String objectName,
                                            //1小程序  2后台管理端
                                            @RequestParam("type") String type) {
        return ossService.getOrdinaryPolicy(objectName, type);
    }


}
